8 / 21

Technical Implementation DetailsURL copied

Markdown Processing PipelineURL copied

  1. Frontmatter extraction: parse_frontmatter() with file mtime-based caching
  2. Footnote extraction: extract_footnotes() using regex to find [^label]: definitions
  3. Superscript/subscript preprocessing: preprocess_super_sub() converts ^text^ and ~text~ to HTML
  4. Callout preprocessing: preprocess_callouts() replaces Obsidian-style callouts such as > [!info] and > [!warning]- Title with placeholders, stores callout data
  5. Tab preprocessing: preprocess_tabs() replaces :::tabs blocks with placeholders, stores tab data
  6. Mistletoe parsing: Custom ContentRenderer with registered tokens:
    • YoutubeEmbed (precedence 6): [yt:VIDEO_ID|caption] syntax
    • FootnoteRef: [^label] references
    • InlineCodeAttr (precedence 8): `code`{.class} syntax
    • Superscript (precedence 7): ^text^ (if not preprocessed)
    • Subscript (precedence 7): ~text~ (if not preprocessed)
    • Strikethrough (precedence 7): ~~text~~
  7. Token rendering: Each token has custom render_* method in ContentRenderer
  8. Tab postprocessing: postprocess_tabs() replaces placeholders with rendered tab HTML
  9. Callout postprocessing: placeholder callouts are rendered back into themed HTML blocks
  10. CSS class application: apply_classes() adds Tailwind classes to HTML elements